<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <base href="${request.contextPath}/"/>
    <meta charset="UTF-8">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,minimum-scale=1.0">
    <title>漠河智慧社区</title>
    <link href="Content/wechat/css/reset.css" rel="stylesheet" type="text/css">
    <!--签到-->
    <link href="Content/wechat/css/dangJian_gongZhuGongJian_CJHD.css" rel="stylesheet" type="text/css">


    <script src="Content/wechat/js/jquery.min.js"></script>
    <!--字体缩放-->
    <script src="Content/wechat/js/ziti.js"></script>
    <!--end 字体缩放-->
    <!--上传图片js-->
    <script  src="Content/wechat/js/svg.js"></script>
    <!--end 上传图片js-->
</head>
<body>
<!--<header class="clearfix">-->
<!--    <h2>在线提问</h2><button class="quxiao_btn">取消</button>-->
<!--</header>-->
<div class="xinyuan">
    <form id="wenda" action="/wechat/home/lawmanage/zxzx/saveWenda" method="post">
    <div class="xinyuan_box">

        <dl class="clearfix">
            <dt>姓名</dt>
            <dd>
                <input name="tname"id="tname" class="text" type="text" placeholder="请输入姓名">
            </dd>
        </dl>


        <dl class="clearfix">
            <dt>联系电话</dt>
            <dd>
                <input  name="tphone" id="tphone" class="text" type="text" placeholder="请输入联系电话">
            </dd>
        </dl>
        <dl class="clearfix">
            <dt>所属社区</dt>
            <dd>
                <select id="shequ" name="taddress">
                    <option>---请选择---</option>
                    <option>北京</option>
                    <option >上海</option><!--设置默认选中项-->
                    <option>广州</option>
                    <option>深圳</option>
                </select>
            </dd>
        </dl>

        <h4>问题：</h4>
        <textarea  name="tcontent"  id="tcontent" class="textarea"  placeholder="请简要说明"></textarea>




    </div>
    <div class="button_shangChuan">确定</div>
    </form>
</div>


</body>
<script>
    window.onload = function () {
        findDemoList();

    }

    function findDemoList() {
        $.ajax({
            url: "/wechat/home/life/zwdt/findShequList",
            type: 'post',
            dataType: 'json',
            success: function (result) {
                //ajaxCallBack(result);
                console.log(result.data);
                var insetViewData = ""; //视图数据
                $.each(result.data, function (index, items) {
                    insetViewData += " <option value=\"" + items.id + "\">" + items.communityname + "</option>";

                });
                $("#shequ").html(insetViewData);

            }

        })
    }


    $(".button_shangChuan").on("click", function () {
        if($("#tname").val()=="" || $("#tname").val()==null){
            alert("请正确填写相关信息！");
            return false;
        }

        if (!(/^1(3|4|5|6|7|8|9)\d{9}$/.test($("#tphone").val()))) {
            alert("请输入正确的手机号格式");
            return false;


        }
        if($("#tcontent").val()=="" || $("#tcontent").val()==null){
            alert("请正确填写相关信息！");
            return false;
        }
        $.ajax({
            type: "POST",   //提交的方法
            url:"/wechat/home/lawmanage/zxzx/saveWenda", //提交的地址
            data:$('#wenda').serialize(),// 序列化表单值
            async: false,
            error: function(data) {  //失败的话
                alert(data.data);
            },
            success: function(data) {  //成功
                alert(data.data);  //就将返回的数据显示出来
                window.location.reload();
            }
        });
    });

</script>
</html>